// import { getUserInfo } from '@/api/user'
import {
  setStorageToken,
  getStorageToken,
  removeStorageToken
} from '@/utils/storage'
export default {
  namespaced: true,
  state: {
    token: getStorageToken()
    // userInfo: {}
  },
  getters: {},
  mutations: {
    setToken(state, payload) {
      state.token = payload
      setStorageToken(payload)
    },
    // setUserInfo(state, payload) {
    //   state.userInfo = payload
    // },
    removeToken(state) {
      state.token = {}

      // 本地存储的删除
      removeStorageToken()
    }
  }
  // actions: {
  //   async getUserInfo(context) {
  //     try {
  //       const res = await getUserInfo()
  //       context.commit('setUserInfo', res.data)
  //     } catch {}
  //   }
  // }
}
